#pragma once
#include "qwindow.h"


namespace micro{


namespace gui{

class QHyperlink :	public QWindow
{
public:
	QHyperlink(void);
	~QHyperlink(void);
	
	
	bool AttachDlgItem(UINT nID, QWindow* pParent);
	virtual bool OnLButtonDown(UINT flags, QPoint& point);
	virtual bool OnLButtonUp(UINT flags, QPoint& point);

protected:
	virtual void OpenUrl();
	
	
	bool	m_bUrlVisited;
	bool	m_bClicked;
	QCOLOR	m_crVisited;
	QCOLOR	m_crNotVisited;
	HCURSOR m_hCursor;
	HFONT	m_hUrlFont;

};


class QLinkCtrl : public QWindow
{
public:
// Constructors
	QLinkCtrl(HWND hWnd = nullptr) : QWindow(hWnd)
	{ }

	QLinkCtrl & operator =(HWND hWnd)
	{
		_window = hWnd;
		return *this;
	}

	HWND Create( )
	{
		return 0;//TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
	}

// Attributes
	virtual LPCTSTR GetWndClassName()
	{
		return WC_LINK;
	}

	int GetIdealHeight(int cxMaxWidth = 0) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, LM_GETIDEALHEIGHT, cxMaxWidth, 0L);
	}

	BOOL GetItem(PLITEM pLItem) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, LM_GETITEM, 0, (LPARAM)pLItem);
	}

	BOOL SetItem(PLITEM pLItem)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, LM_SETITEM, 0, (LPARAM)pLItem);
	}

	// Vista only
	int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const
	{
#ifndef LM_GETIDEALSIZE
		const UINT LM_GETIDEALSIZE = LM_GETIDEALHEIGHT;
#endif
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size);
	}

// Operations
	BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, LM_HITTEST, 0, (LPARAM)pLHitTestInfo);
	}
};

}//

}//micro